﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Masini
{
    class Program
    {
        static void Main(string[] args)
        {
            int OK;
            int ok;
            
            List <Client> lista_clienti = new List <Client>();


           
            ObjectPool pool = new ObjectPool();
            

                int bine;
                string m;

                do
                {
                    Client _client = new Client();
                    Console.WriteLine("1.Incepeti 2.Stop");
                     m = Console.ReadLine();


                    if (m == "1")
                        do
                        {

                            ok = 0;
                            _client.set_client();
                            if (lista_clienti.Contains(_client)) bine = 1;
                            else { lista_clienti.Add(_client); bine = 1; }


                            if (bine == 1)
                                do
                                {
                                    OK = 0;
                                    Console.WriteLine("Introduceti tipul masinii: 1-Sedan 2-Coupe 3-Mini sau stop");
                                    string n = Console.ReadLine();


                                    if (n == "1")
                                    {
                                        Sedan _Sedan = new Sedan();

                                        pool.GetMasinaSedan();

                                        _client.add((Sedan)pool.objPoolSedan.Dequeue());

                                    }

                                    if (n == "2")
                                    {
                                        Coupe _Coupe = new Coupe();

                                        //_Coupe.setari();

                                        pool.GetMasinaCoupe();

                                        _client.add((Coupe)pool.objPoolCoupe.Dequeue());
                                    }

                                    if (n == "3")
                                    {
                                        Mini _Mini = new Mini();

                                        //_Mini.setari();

                                        pool.GetMasinaMini();

                                        _client.add((Mini)pool.objPoolMini.Dequeue());

                                    }
                                    if (n == "stop") OK = 1;

                                } while (OK == 0);

                            if (m == "1") ok = 1;

                        } while (ok == 0);

                } while (m == "1");

            foreach (Client cl in lista_clienti)
            {
                Console.WriteLine(cl.get_nume());
                foreach (AbstractMasina element in cl.Lista_masini)
                { element.afisare();}
            }

            Console.ReadKey();
        }
    }
}
